var fileHost = 'https://oss-token-test.oss-cn-hangzhou.aliyuncs.com/bsh/'; //你的阿里云地址最后面跟上一个/   在你当前小程序的后台的uploadFile 合法域名也要配上这个域名
var accessKeySecret = ''
var oSSAccessKeyId = ''

function havetime(unixtime) {
	var date = new Date(unixtime);
	var y = date.getFullYear();
	var m = date.getMonth() + 1;
	m = m < 10 ? ('0' + m) : m;
	var d = date.getDate();
	d = d < 10 ? ('0' + d) : d;
	var h = date.getHours();
	h = h < 10 ? ('0' + h) : h;
	var minute = date.getMinutes();
	var second = date.getSeconds();
	minute = minute < 10 ? ('0' + minute) : minute;
	second = second < 10 ? ('0' + second) : second;
	return y + '-' + m + '-' + d + ' ' + h + ':' + minute + ':' + second; //年月日时分秒
	// return y + '-' + m + '-' + d + ' ' + h + ':' + minute;
};
var time = havetime(new Date().getTime())
uni.request({
	url: 'http://sts.ck9696.com/oss/ckOSSServer/getCkOSSToken',
	method: 'post',
	data: {
		'exchangeTime': time,
		'channelId': '1',
		'channelNo': '1',
		'channelPassword': '1',
		'appVersion': '1',
		'appMobileModel': '1'
	},

	success: function(res) {

		// res.data.data.bucket = 'oss-token-test'
		// // res.data.data.endpoint = 'https://oss-cn-hangzhou.aliyuncs.com'
		// res.data.data.Endpoint = 'https://oss-cn-hangzhou.aliyuncs.com'
		accessKeySecret = res.data.data.accessKeySecret
		oSSAccessKeyId = res.data.data.accessKeyId
		// res.data.data.AccessKeyId = res.data.data.accessKeyId
		// res.data.data.AccessKeySecret = res.data.data.accessKeySecret
		// res.data.data.stsToken = res.data.data.securityToken
		console.log(res.data.data, 'res.data.datares.data.data')
	},
	fail: function(res) {
		console.log(res, 'resssssssssssssssssssssssssssssssssss')
		uni.showToast({
			title: res,
			icon: 'none',
			duration: 2000
		})
	}
})
var config = {
	//aliyun OSS config
	uploadImageUrl: `${fileHost}`, // 默认存在根目录，可根据需求改
	AccessKeySecret: "2kc2nqZgGwJQXxSpxoyGvdCQAMKsx3rMYse14NquQgrc", // AccessKeySecret 去你的阿里云上控制台上找
	OSSAccessKeyId: 'STS.NSyvGLS2yXwhHMGV87QpYWDXx', // AccessKeyId 去你的阿里云上控制台上找
	timeout: 87600 //这个是上传文件时Policy的失效时间
};

console.log(config,'configconfigconfig')
module.exports = config